IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'club')
	DROP DATABASE [club]
GO

CREATE DATABASE [club]  ON (NAME = N'club_Data', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL\data\club_Data.MDF' , SIZE = 2, FILEGROWTH = 10%) LOG ON (NAME = N'club_Log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL\data\club_Log.LDF' , SIZE = 1, FILEGROWTH = 10%)
 COLLATE Modern_Spanish_CI_AS
GO

exec sp_dboption N'club', N'autoclose', N'false'
GO

exec sp_dboption N'club', N'bulkcopy', N'false'
GO

exec sp_dboption N'club', N'trunc. log', N'false'
GO

exec sp_dboption N'club', N'torn page detection', N'true'
GO

exec sp_dboption N'club', N'read only', N'false'
GO

exec sp_dboption N'club', N'dbo use', N'false'
GO

exec sp_dboption N'club', N'single', N'false'
GO

exec sp_dboption N'club', N'autoshrink', N'false'
GO

exec sp_dboption N'club', N'ANSI null default', N'false'
GO

exec sp_dboption N'club', N'recursive triggers', N'false'
GO

exec sp_dboption N'club', N'ANSI nulls', N'false'
GO

exec sp_dboption N'club', N'concat null yields null', N'false'
GO

exec sp_dboption N'club', N'cursor close on commit', N'false'
GO

exec sp_dboption N'club', N'default to local cursor', N'false'
GO

exec sp_dboption N'club', N'quoted identifier', N'false'
GO

exec sp_dboption N'club', N'ANSI warnings', N'false'
GO

exec sp_dboption N'club', N'auto create statistics', N'true'
GO

exec sp_dboption N'club', N'auto update statistics', N'true'
GO

use [club]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FKDE3A0F1EE866B39]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[ProfesionalActividad] DROP CONSTRAINT FKDE3A0F1EE866B39
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK7BF947D80B280CB]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[UsuarioActividadProfesional] DROP CONSTRAINT FK7BF947D80B280CB
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FKF814F32EEEF081DF]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[usuario] DROP CONSTRAINT FKF814F32EEEF081DF
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK7F99188FFB2A71A7]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[transaccion] DROP CONSTRAINT FK7F99188FFB2A71A7
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FKF814F32EFB2A71A7]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[usuario] DROP CONSTRAINT FKF814F32EFB2A71A7
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK7BF947DFB2A71A7]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[UsuarioActividadProfesional] DROP CONSTRAINT FK7BF947DFB2A71A7
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK7F99188FF85749C8]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[transaccion] DROP CONSTRAINT FK7F99188FF85749C8
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FKF814F32E87D693E7]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[usuario] DROP CONSTRAINT FKF814F32E87D693E7
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK7F99188F2E745681]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[transaccion] DROP CONSTRAINT FK7F99188F2E745681
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_cuentaprofesional_profesional]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[cuentaprofesional] DROP CONSTRAINT FK_cuentaprofesional_profesional
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FKB1C738413B161A9]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[cuentaprofesional] DROP CONSTRAINT FKB1C738413B161A9
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FKDE3A0F113B161A9]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[ProfesionalActividad] DROP CONSTRAINT FKDE3A0F113B161A9
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK7BF947D13B161A9]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[UsuarioActividadProfesional] DROP CONSTRAINT FK7BF947D13B161A9
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_reserva_recurso]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[reserva] DROP CONSTRAINT FK_reserva_recurso
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK41640CB88C5FB523]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[reserva] DROP CONSTRAINT FK41640CB88C5FB523
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK7F99188F8E141A01]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[transaccion] DROP CONSTRAINT FK7F99188F8E141A01
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_operacion_subsistemacontable]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[operacion] DROP CONSTRAINT FK_operacion_subsistemacontable
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK63131B189C00E862]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[operacion] DROP CONSTRAINT FK63131B189C00E862
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FKF814F32E7CAE669A]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[usuario] DROP CONSTRAINT FKF814F32E7CAE669A
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FKF814F32E3C459309]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[usuario] DROP CONSTRAINT FKF814F32E3C459309
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FKF814F32EC2622E60]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[usuario] DROP CONSTRAINT FKF814F32EC2622E60
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Actividad]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Actividad]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EstadoActividad]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[EstadoActividad]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ProfesionalActividad]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[ProfesionalActividad]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[UsuarioActividadProfesional]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[UsuarioActividadProfesional]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[actividadFija]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[actividadFija]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[cuentaUsuario]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[cuentaUsuario]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[cuentaprofesional]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[cuentaprofesional]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[dtproperties]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[dtproperties]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[estadoTransaccion]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[estadoTransaccion]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[estadoUsuario]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[estadoUsuario]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[operacion]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[operacion]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[profesional]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[profesional]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[recurso]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[recurso]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[reserva]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[reserva]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[subsistemacontable]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[subsistemacontable]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tipoDocumento]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[tipoDocumento]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[transaccion]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[transaccion]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usuario]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[usuario]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usuarioDatoMedico]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[usuarioDatoMedico]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usuarioDatoPersonal]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[usuarioDatoPersonal]
GO

CREATE TABLE [dbo].[Actividad] (
	[id_actividades] [int] IDENTITY (1, 1) NOT NULL ,
	[id_estado] [int] NOT NULL ,
	[nombre] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[descripcion] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[fechaInicio] [datetime] NULL ,
	[fechaFin] [datetime] NULL ,
	[importe] [float] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[EstadoActividad] (
	[id_estado] [int] IDENTITY (1, 1) NOT NULL ,
	[nombre] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[descripcion] [varchar] (200) COLLATE Modern_Spanish_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[ProfesionalActividad] (
	[id_actividades] [int] NOT NULL ,
	[id_profesional] [int] NOT NULL ,
	[fechaInicio] [datetime] NULL ,
	[fechaFin] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[UsuarioActividadProfesional] (
	[id_cuenta] [int] NOT NULL ,
	[id_actividad] [int] NOT NULL ,
	[id_profesional] [int] NOT NULL ,
	[fechaInicio] [datetime] NULL ,
	[fechaFin] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[actividadFija] (
	[id_actividadFija] [int] IDENTITY (1, 1) NOT NULL ,
	[nombre] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[descripcion] [varchar] (200) COLLATE Modern_Spanish_CI_AS NULL ,
	[importe] [float] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[cuentaUsuario] (
	[id_cuenta] [int] IDENTITY (1, 1) NOT NULL ,
	[fechaInicio] [datetime] NULL ,
	[fechaActualizacion] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[cuentaprofesional] (
	[id_cuenta] [int] IDENTITY (1, 1) NOT NULL ,
	[id_profesional] [int] NOT NULL ,
	[fechaInicio] [datetime] NULL ,
	[fechaFin] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[dtproperties] (
	[id] [int] NOT NULL ,
	[property] [varchar] (64) COLLATE Modern_Spanish_CI_AS NOT NULL ,
	[objectid] [int] NULL ,
	[value] [varchar] (255) COLLATE Modern_Spanish_CI_AS NULL ,
	[uvalue] [varchar] (255) COLLATE Modern_Spanish_CI_AS NULL ,
	[lvalue] [varchar] (255) COLLATE Modern_Spanish_CI_AS NULL ,
	[version] [int] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[estadoTransaccion] (
	[id_estado] [int] IDENTITY (1, 1) NOT NULL ,
	[nombre] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[descripcion] [varchar] (200) COLLATE Modern_Spanish_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[estadoUsuario] (
	[id_estado] [int] IDENTITY (1, 1) NOT NULL ,
	[nombre] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[descripcion] [varchar] (200) COLLATE Modern_Spanish_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[operacion] (
	[id_Operacion] [int] IDENTITY (1, 1) NOT NULL ,
	[nombre] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[descripcion] [varchar] (200) COLLATE Modern_Spanish_CI_AS NULL ,
	[idSubsistemaContable] [int] NOT NULL ,
	[claseCuenta] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[accion] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[profesional] (
	[id_profesional] [int] IDENTITY (1, 1) NOT NULL ,
	[apellido] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[nombre] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[fechaInicio] [datetime] NULL ,
	[fechafin] [datetime] NULL ,
	[descripcion] [varchar] (200) COLLATE Modern_Spanish_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[recurso] (
	[id_recurso] [int] IDENTITY (1, 1) NOT NULL ,
	[nombreRecurso] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[descripcion] [varchar] (200) COLLATE Modern_Spanish_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[reserva] (
	[id_reserva] [int] IDENTITY (1, 1) NOT NULL ,
	[id_recurso] [int] NOT NULL ,
	[nombre] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[fechaVigencia] [datetime] NULL ,
	[fechaInicio] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[subsistemacontable] (
	[idsubsistemacontable] [int] IDENTITY (1, 1) NOT NULL ,
	[nombre] [varchar] (18) COLLATE Modern_Spanish_CI_AS NULL ,
	[descripcion] [varchar] (18) COLLATE Modern_Spanish_CI_AS NULL ,
	[activo] [bit] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[tipoDocumento] (
	[id_tipoDocumento] [int] IDENTITY (1, 1) NOT NULL ,
	[descripcion] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[transaccion] (
	[id_transaccion] [int] IDENTITY (1, 1) NOT NULL ,
	[id_reserva] [int] NULL ,
	[id_cuenta] [int] NULL ,
	[id_estado] [int] NULL ,
	[fecha] [datetime] NULL ,
	[descripcion] [varchar] (200) COLLATE Modern_Spanish_CI_AS NULL ,
	[importe] [float] NULL ,
	[id_operacion] [int] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[usuario] (
	[id_usuario] [int] IDENTITY (1, 1) NOT NULL ,
	[idTipoDocumento] [int] NOT NULL ,
	[id_datosPersonales] [int] NULL ,
	[id_estado] [int] NOT NULL ,
	[id_cuenta] [int] NOT NULL ,
	[id_actividadFija] [int] NOT NULL ,
	[codigo] [varchar] (50) COLLATE Modern_Spanish_CI_AS NOT NULL ,
	[apellido] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[nombre] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[nro_documento] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[id_datomedico] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[usuarioDatoMedico] (
	[id_datomedico] [int] IDENTITY (1, 1) NOT NULL ,
	[observaciones] [varchar] (250) COLLATE Modern_Spanish_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[usuarioDatoPersonal] (
	[id_datosPersonales] [int] IDENTITY (1, 1) NOT NULL ,
	[calle] [varchar] (200) COLLATE Modern_Spanish_CI_AS NULL ,
	[nro] [varchar] (10) COLLATE Modern_Spanish_CI_AS NULL ,
	[depto] [varchar] (10) COLLATE Modern_Spanish_CI_AS NULL ,
	[piso] [varchar] (10) COLLATE Modern_Spanish_CI_AS NULL ,
	[codigoPostal] [varchar] (10) COLLATE Modern_Spanish_CI_AS NULL ,
	[telefono1] [varchar] (25) COLLATE Modern_Spanish_CI_AS NULL ,
	[telefono2] [varchar] (25) COLLATE Modern_Spanish_CI_AS NULL 
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[Actividad] WITH NOCHECK ADD 
	 PRIMARY KEY  CLUSTERED 
	(
		[id_actividades]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[EstadoActividad] WITH NOCHECK ADD 
	 PRIMARY KEY  CLUSTERED 
	(
		[id_estado]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[ProfesionalActividad] WITH NOCHECK ADD 
	 PRIMARY KEY  CLUSTERED 
	(
		[id_actividades],
		[id_profesional]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[UsuarioActividadProfesional] WITH NOCHECK ADD 
	 PRIMARY KEY  CLUSTERED 
	(
		[id_cuenta],
		[id_actividad],
		[id_profesional]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[actividadFija] WITH NOCHECK ADD 
	 PRIMARY KEY  CLUSTERED 
	(
		[id_actividadFija]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[cuentaUsuario] WITH NOCHECK ADD 
	 PRIMARY KEY  CLUSTERED 
	(
		[id_cuenta]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[cuentaprofesional] WITH NOCHECK ADD 
	CONSTRAINT [PK_cuentaprofesional] PRIMARY KEY  CLUSTERED 
	(
		[id_cuenta]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[dtproperties] WITH NOCHECK ADD 
	 PRIMARY KEY  CLUSTERED 
	(
		[id],
		[property]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[estadoTransaccion] WITH NOCHECK ADD 
	 PRIMARY KEY  CLUSTERED 
	(
		[id_estado]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[estadoUsuario] WITH NOCHECK ADD 
	 PRIMARY KEY  CLUSTERED 
	(
		[id_estado]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[operacion] WITH NOCHECK ADD 
	CONSTRAINT [PK_operacion] PRIMARY KEY  CLUSTERED 
	(
		[id_Operacion]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[profesional] WITH NOCHECK ADD 
	 PRIMARY KEY  CLUSTERED 
	(
		[id_profesional]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[recurso] WITH NOCHECK ADD 
	 PRIMARY KEY  CLUSTERED 
	(
		[id_recurso]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[reserva] WITH NOCHECK ADD 
	 PRIMARY KEY  CLUSTERED 
	(
		[id_reserva]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[subsistemacontable] WITH NOCHECK ADD 
	CONSTRAINT [PK__asiento__2F3AE904] PRIMARY KEY  CLUSTERED 
	(
		[idsubsistemacontable]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[tipoDocumento] WITH NOCHECK ADD 
	 PRIMARY KEY  CLUSTERED 
	(
		[id_tipoDocumento]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[transaccion] WITH NOCHECK ADD 
	 PRIMARY KEY  CLUSTERED 
	(
		[id_transaccion]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[usuario] WITH NOCHECK ADD 
	 PRIMARY KEY  CLUSTERED 
	(
		[id_usuario]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[usuarioDatoMedico] WITH NOCHECK ADD 
	 PRIMARY KEY  CLUSTERED 
	(
		[id_datomedico]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[usuarioDatoPersonal] WITH NOCHECK ADD 
	 PRIMARY KEY  CLUSTERED 
	(
		[id_datosPersonales]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[ProfesionalActividad] ADD 
	CONSTRAINT [FKDE3A0F113B161A9] FOREIGN KEY 
	(
		[id_profesional]
	) REFERENCES [dbo].[profesional] (
		[id_profesional]
	),
	CONSTRAINT [FKDE3A0F1EE866B39] FOREIGN KEY 
	(
		[id_actividades]
	) REFERENCES [dbo].[Actividad] (
		[id_actividades]
	)
GO

ALTER TABLE [dbo].[UsuarioActividadProfesional] ADD 
	CONSTRAINT [FK7BF947D13B161A9] FOREIGN KEY 
	(
		[id_profesional]
	) REFERENCES [dbo].[profesional] (
		[id_profesional]
	),
	CONSTRAINT [FK7BF947D80B280CB] FOREIGN KEY 
	(
		[id_actividad]
	) REFERENCES [dbo].[Actividad] (
		[id_actividades]
	),
	CONSTRAINT [FK7BF947DFB2A71A7] FOREIGN KEY 
	(
		[id_cuenta]
	) REFERENCES [dbo].[cuentaUsuario] (
		[id_cuenta]
	)
GO

ALTER TABLE [dbo].[cuentaprofesional] ADD 
	CONSTRAINT [FK_cuentaprofesional_profesional] FOREIGN KEY 
	(
		[id_profesional]
	) REFERENCES [dbo].[profesional] (
		[id_profesional]
	),
	CONSTRAINT [FKB1C738413B161A9] FOREIGN KEY 
	(
		[id_profesional]
	) REFERENCES [dbo].[profesional] (
		[id_profesional]
	)
GO

ALTER TABLE [dbo].[operacion] ADD 
	CONSTRAINT [FK_operacion_subsistemacontable] FOREIGN KEY 
	(
		[idSubsistemaContable]
	) REFERENCES [dbo].[subsistemacontable] (
		[idsubsistemacontable]
	),
	CONSTRAINT [FK63131B189C00E862] FOREIGN KEY 
	(
		[idSubsistemaContable]
	) REFERENCES [dbo].[subsistemacontable] (
		[idsubsistemacontable]
	)
GO

ALTER TABLE [dbo].[reserva] ADD 
	CONSTRAINT [FK_reserva_recurso] FOREIGN KEY 
	(
		[id_recurso]
	) REFERENCES [dbo].[recurso] (
		[id_recurso]
	),
	CONSTRAINT [FK41640CB88C5FB523] FOREIGN KEY 
	(
		[id_recurso]
	) REFERENCES [dbo].[recurso] (
		[id_recurso]
	)
GO

ALTER TABLE [dbo].[transaccion] ADD 
	CONSTRAINT [FK7F99188F2E745681] FOREIGN KEY 
	(
		[id_operacion]
	) REFERENCES [dbo].[operacion] (
		[id_Operacion]
	),
	CONSTRAINT [FK7F99188F8E141A01] FOREIGN KEY 
	(
		[id_reserva]
	) REFERENCES [dbo].[reserva] (
		[id_reserva]
	),
	CONSTRAINT [FK7F99188FF85749C8] FOREIGN KEY 
	(
		[id_estado]
	) REFERENCES [dbo].[estadoTransaccion] (
		[id_estado]
	),
	CONSTRAINT [FK7F99188FFB2A71A7] FOREIGN KEY 
	(
		[id_cuenta]
	) REFERENCES [dbo].[cuentaUsuario] (
		[id_cuenta]
	)
GO

ALTER TABLE [dbo].[usuario] ADD 
	CONSTRAINT [FKF814F32E3C459309] FOREIGN KEY 
	(
		[id_datomedico]
	) REFERENCES [dbo].[usuarioDatoMedico] (
		[id_datomedico]
	),
	CONSTRAINT [FKF814F32E7CAE669A] FOREIGN KEY 
	(
		[idTipoDocumento]
	) REFERENCES [dbo].[tipoDocumento] (
		[id_tipoDocumento]
	),
	CONSTRAINT [FKF814F32E87D693E7] FOREIGN KEY 
	(
		[id_estado]
	) REFERENCES [dbo].[estadoUsuario] (
		[id_estado]
	),
	CONSTRAINT [FKF814F32EC2622E60] FOREIGN KEY 
	(
		[id_datosPersonales]
	) REFERENCES [dbo].[usuarioDatoPersonal] (
		[id_datosPersonales]
	),
	CONSTRAINT [FKF814F32EEEF081DF] FOREIGN KEY 
	(
		[id_actividadFija]
	) REFERENCES [dbo].[actividadFija] (
		[id_actividadFija]
	),
	CONSTRAINT [FKF814F32EFB2A71A7] FOREIGN KEY 
	(
		[id_cuenta]
	) REFERENCES [dbo].[cuentaUsuario] (
		[id_cuenta]
	)
GO

